<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
   <title>课程管理</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
		<script type="text/javascript" src="__JS__/jshelper.js"></script> 
			<script type="text/JavaScript">
				function courseedit(id){
					window.location.href="__URL__/courseedit/id/"+id;
				}
				function coursesearch(id){
					window.location.href="__URL__/coursedetail/id/"+id;
				}
				function coursedelete(id){
					if (confirm("你确定要删除吗")==true) 
						postwith('__URL__/coursedelete',{id:id});
				}
				function course(id)
				{
					postwith('__URL__/course',{id:id});
				}
				
				window.onload=show;
			</script>
</head>
<body>
<!-- layout::Auth:header::0 -->
 <div class="container-fluid">
      <div class="row-fluid">
      <!-- layout::Auth:leftmenu::0 -->
      	 <div class="span8">
          <div class="hero-unit">
          	<h1>课程管理</h1>
            	<p style="font-size:12px">当前位置：
                	<a href='__APP__/index/index'  >主页</a>>
                    <a href='__URL__/index' >后台管理</a>>
                    <a href="__URL__/coursedetail"  >课程管理</a>
                </p>
            </div>
            <?php if($role != '教师'): ?><table class="table table-striped table-bordered table-condensed">
                <thead>
                	<tr>
                    	<th style="background-color:#09F">
                            管理员课程操作
                        </th>
                	</tr>
                </thead>
                <tbody>
                	<tr>
                    	<td>
                        	<a href="__URL__/courseadd" class="btn btn-success">添加课程</a>
                            <a href="__URL__/courseapprove" class="btn btn-primary" title="所选课程教师管理员二次确认">课程认证</a>
                        </td>
                    </tr>
                </tbody>
            </table><?php endif; ?>
           <form class="form-inline" method="get" action="__URL__/coursedetail" >
           <table  class="table table-striped table-bordered table-condensed">
           	<thead>
            	<tr style="background-color:#09F">
                	<th style="color:#000">课程查询</th>
                </tr>
            </thead>
            <tbody>
            	<tr>
                	<td>
                    	<input type="text" name="number" placeholder="课程序号">
                        <input type="text" name="name" placeholder="课程名称">
                        <code>院系名称</code><select name="dname" >
                                    <option value></option>						  
                                        <?php if(is_array($deplist)): $i = 0; $__LIST__ = $deplist;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): ++$i;$mod = ($i % 2 )?><option value =	<?php echo ($vo["name"]); ?>><?php echo ($vo["name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                                </select>
                        <input type="submit" onClick="coursesearch(id)" value="查询" class="btn btn-primary">
                    </td>
                </tr>
            </tbody>
           </table>	
		</form> 
			<table class="table table-striped table-bordered table-condensed">
            	<thead>
                	<tr style="background-color:#09F">
                    	<th style="display:none">课程ID</th>
                    	<th style="width:10%">课程序号</th>
                        <th style="width:35%">课程名称</th>
                        <th style="width:15%">所属院系</th>
                        <th style="width:40%">操作</th>
                    </tr>
                </thead>
                <load href"__PUBLIC__/js/list_show.js">
                <tbody>
                	<?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): ++$i;$mod = ($i % 2 )?><tr>
                    	<td style="display:none"><?php echo ($vo["id"]); ?></td>
                        <td><?php echo ($vo["number"]); ?></td>
                        <?php if($vo["isselect"] != 0): ?><td><strong><?php echo ($vo["name"]); ?> (已选择)</strong></td></td>
                       	<?php else: ?>
                        <td><?php echo ($vo["name"]); ?></td><?php endif; ?>
                        <td><?php echo ($vo["dname"]); ?></td>
                        <td>
                        	<?php if($vo["isselect"] == 0): ?><a name="courseedit" onClick="course('<?php echo ($vo["id"]); ?>')" href="#" class="btn btn-success">选择</a>
                            <!--<input type="button" name="courseedit"  onClick="course(<?php echo ($vo["id"]); ?>)" value="选择">-->
                            <?php else: ?>
                            <a name="courseedit" onClick="course('<?php echo ($vo["id"]); ?>')" href="#" class="btn btn-warning">取消</a>
                            <!--<input type="button" name="courseedit"  onClick="course(<?php echo ($vo["id"]); ?>)" value="取消">--><?php endif; ?>
                                <?php if($vo["select"] == 1): ?><a name="courseedit" onClick="courseedit('<?php echo ($vo["id"]); ?>')" href="#" class="btn btn-primary">编辑</a><?php endif; ?>
                                <?php if($role != '教师'): ?><a name="delete_course" onClick="coursedelete('<?php echo ($vo["id"]); ?>')"   href="#" class="btn btn-danger">删除</a><?php endif; ?>
               		 </td>
               		 </tr><?php endforeach; endif; else: echo "" ;endif; ?>
                </tbody>
            </table>
             <p class="navbar-text pull-right"><?php echo ($page); ?></p>
          </div>
          </div>
         </div>
       
		<script src="__JS__/placeholderIEshow.js"></script>
</body>
</html>